#include <bits/stdc++.h>
using namespace std;


class Solution
{
public:
    int n;
    vector<int> tmp;
    int ans;
    void dfs(int x, vector<int> & nums)
    {
        if (x == n)
        {
            int now = 0;
            for (auto & num : tmp)
            {
                now ^= num;
            }
            ans += now;
            return ;
        }
        //选
        tmp.emplace_back(nums[x]);
        dfs(x + 1, nums);
        tmp.pop_back();
        //不选
        dfs(x + 1,nums);
    }
    int subsetXORSum(vector<int>& nums)
    {
        n = nums.size();
        dfs(0 , nums);
        return ans;
    }
};
